import { hasPermission } from "@/utils";

export default {
  inserted(el, { value }) {
    if (value && value instanceof Array && value.length > 0) {
      if (!hasPermission(value)) {
        el.parentNode && el.parentNode.removeChild(el)
      }
    } else {
      throw new Error(`need permission! For example v-permission="['home']"`)
    }
  }
};